﻿using System;
using UnityEngine;

namespace UniRx.Triggers
{
	// Token: 0x0200044C RID: 1100
	[DisallowMultipleComponent]
	public class ObservableVisibleTrigger : ObservableTriggerBase
	{
		// Token: 0x0600177A RID: 6010 RVA: 0x00063E1C File Offset: 0x0006221C
		private void OnBecameInvisible()
		{
			if (this.onBecameInvisible != null)
			{
				this.onBecameInvisible.OnNext(Unit.Default);
			}
		}

		// Token: 0x0600177B RID: 6011 RVA: 0x00063E3C File Offset: 0x0006223C
		public IObservable<Unit> OnBecameInvisibleAsObservable()
		{
			Subject<Unit> result;
			if ((result = this.onBecameInvisible) == null)
			{
				result = (this.onBecameInvisible = new Subject<Unit>());
			}
			return result;
		}

		// Token: 0x0600177C RID: 6012 RVA: 0x00063E64 File Offset: 0x00062264
		private void OnBecameVisible()
		{
			if (this.onBecameVisible != null)
			{
				this.onBecameVisible.OnNext(Unit.Default);
			}
		}

		// Token: 0x0600177D RID: 6013 RVA: 0x00063E84 File Offset: 0x00062284
		public IObservable<Unit> OnBecameVisibleAsObservable()
		{
			Subject<Unit> result;
			if ((result = this.onBecameVisible) == null)
			{
				result = (this.onBecameVisible = new Subject<Unit>());
			}
			return result;
		}

		// Token: 0x0600177E RID: 6014 RVA: 0x00063EAC File Offset: 0x000622AC
		protected override void RaiseOnCompletedOnDestroy()
		{
			if (this.onBecameInvisible != null)
			{
				this.onBecameInvisible.OnCompleted();
			}
			if (this.onBecameVisible != null)
			{
				this.onBecameVisible.OnCompleted();
			}
		}

		// Token: 0x04000CE0 RID: 3296
		private Subject<Unit> onBecameInvisible;

		// Token: 0x04000CE1 RID: 3297
		private Subject<Unit> onBecameVisible;
	}
}
